/*
 * @Author: 张鹏
 * @Date: 2025-06-19 16:39:29
 * @LastEditors: fyukeeh 15849141465@163.com
 * @LastEditTime: 2025-08-01 10:44:07
 * @FilePath: \mapbox\src\router\index.js
 * @Description: 
 * 
 */
import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/layout/index.vue";
import { clearContextMenu } from "289-map";

const routes = [
  // 示例首页路由，可根据需要添加更多页面
  {
    path: "/",
    name: "Home",
    redirect: "home",
    component: Layout,
    children: [
      {
        path: "home",
        component: () => import("@/views/Home.vue"),
        meta: {
          hidden: true,
        },
      },
      {
        path: "BillboardEntity",
        component: () => import("@/views/example/BillboardEntity.vue"),
      },
      {
        path: "Arrow",
        component: () => import("@/views/example/Arrow.vue"),
      },
      {
        path: "PointLinePolygon",
        component: () => import("@/views/example/PointLinePolygon.vue"),
      },
      {
        path: "Draw",
        component: () => import("@/views/example/Draw.vue"),
      },
      {
        path: "SplitScreen",
        component: () => import("@/views/example/SplitScreen.vue"),
      },
      {
        path: "DynamicStyle",
        component: () => import("@/views/example/DynamicStyle.vue"),
      },
      {
        path: "TrajectoryPlayback",
        component: () => import("@/views/example/TrajectoryPlayback.vue"),
      },
      {
        path: "SatelliteDemo",
        component: () => import("@/views/example/SatelliteDemo.vue"),
      },
      {
        path: "TiandituBasemap",
        component: () => import("@/views/example/TiandituBasemap.vue"),
      },
      {
        path: "ThreeModelExample",
        component: () => import("@/views/example/ThreeModelExample.vue"),
      },
      {
        path: "MaterialDemo",
        component: () => import("@/views/example/MaterialDemo.vue"),
      },
      {
        path: "AllEntitiesDemo",
        component: () => import("@/views/example/AllEntitiesDemo.vue"),
      },
      {
        path: "Buildings3D",
        component: () => import("@/views/example/Buildings3D.vue"),
      },
      {
        path: "RadarScanExample",
        component: () => import("@/views/example/RadarScanExample.vue"),
      },
      {
        path: "BoundaryWallExample",
        component: () => import("@/views/example/BoundaryWallExample.vue"),
      }
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

// 路由切换时清理右键菜单
router.beforeEach((to, from, next) => {
  // 清理右键菜单
  clearContextMenu();
  next();
});

export default router;
